package com.peanut.bosskg.service.other.separate;

import com.alibaba.fastjson.JSON;
import com.peanut.bosskg.entity.ResponseMessageVO;
import com.peanut.bosskg.entity.separate.RechargeResultVO;
import com.peanut.bosskg.enums.FunCodeEnum;
import com.peanut.bosskg.service.BaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @param
 * @author LMH
 * @return
 * @description
 * @createby 2022-06-13 14:15
 */
@Service
@Slf4j
public class RechargeRecordQueryService extends BaseService {
    /**
     * @param funCodeEnum
     * @param providerId 服务商ID（联系运营获取）
     * @param startDate 查询充值记录开始时间
     * @param endDate 查询充值记录结束时间
     * @return 充值记录列表
     * @throws Exception
     */
    public List<RechargeResultVO> doBusiness(FunCodeEnum funCodeEnum, Long providerId, String startDate, String endDate) throws Exception {
        log.info("用户充值记录查询接口开始:{}，providerId={}，startDate={}，endDate={}", funCodeEnum, providerId, startDate, endDate);
        Map<String, Object> queryMap = new HashMap<>();
        queryMap.put("providerId", providerId);
        queryMap.put("startDate", startDate);
        queryMap.put("endDate", endDate);
        ResponseMessageVO responseMessage = applyYouFuByHttpPost(funCodeEnum, queryMap);
        List<RechargeResultVO> resultVOList = JSON.parseArray(responseMessage.getResData(), RechargeResultVO.class);
        log.info("用户充值记录查询接口结束:{}", resultVOList);
        return resultVOList;
    }
}
